package com.author.util;

/**
 * Validate the name of the Operating System on which this program is running
 */
public class OSValidator {
	private static boolean	IS_WINDOWS		= false;
	private static boolean	IS_MACINTOSH	= false;
	private static boolean	IS_UNIX			= false;

	public OSValidator() {
		String os = System.getProperty("os.name").toLowerCase();
		if (os.indexOf("win") >= 0) {
			OSValidator.IS_WINDOWS = true;
		} else if (os.indexOf("mac") >= 0) {
			OSValidator.IS_MACINTOSH = true;
		} else if (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0) {
			OSValidator.IS_UNIX = true;
		} else {
			throw new RuntimeException("Unsupportted OS");
		}
	}

	public static boolean isWindows() {
		return OSValidator.IS_WINDOWS;
	}

	public static boolean isMac() {
		return OSValidator.IS_MACINTOSH;
	}

	public static boolean isUnix() {
		return OSValidator.IS_UNIX;
	}
}